package uk.ac.lkl.lpp.ui;



import javax.swing.JLabel;

import uk.ac.lkl.lpp.model.PedagogyPlanModel;
import uk.ac.lkl.lpp.model.ldo.TeachingMethod;


/**
 * A view of a teaching method that uses its title as a label.
 * 
 * @author Darren Pearce
 * @version $Revision$
 * @version $Date$
 * 
 */
public class LabelTeachingMethodView extends TeachingMethodView {

    private JLabel label;


    public LabelTeachingMethodView(TeachingMethod teachingMethod,
            PedagogyPlanModel pedagogyPlanModel) {
        super(teachingMethod, pedagogyPlanModel);
        label = new JLabel();
        add(label);
        updateView();
    }


    public void updateView() {
        String title = getTeachingMethod().getTitle();
        label.setText(title);
    }


    public LabelTeachingMethodView create(TeachingMethod teachingMethod) {
        return new LabelTeachingMethodView(teachingMethod,
                getPedagogyPlanModel());
    }

}
